<script setup lang="ts">
import { ref } from 'vue'
import { ElConfigProvider } from 'element-plus'
import zh from 'element-plus/dist/locale/zh-cn.mjs'
import en from 'element-plus/dist/locale/en.mjs'
import { useI18n } from 'vue-i18n'
import HelloWorld from '@/components/HelloWorld.vue'
const locale = ref(zh)

const { t, locale: langLocal } = useI18n()
const changeLang = (lang: 'zh' | 'en'): void => {
  const lag = {
    zh,
    en
  }
  locale.value = lag[lang]
  langLocal.value = lang
}
</script>

<template>
  <el-config-provider :locale="locale">
    <el-button @click="changeLang('zh')">中文</el-button>
    <el-button @click="changeLang('en')">英文</el-button>
    {{ t('header.langLable') }}
    <el-date-picker type="date" placeholder="Pick a day" />
    <HelloWorld msg="Vite + Vue" />
  </el-config-provider>
</template>

<style scoped>
.logo {
  height: 6em;
  padding: 1.5em;
  will-change: filter;
  transition: filter 300ms;
}
.logo:hover {
  filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.vue:hover {
  filter: drop-shadow(0 0 2em #42b883aa);
}
</style>
